namespace VAdvantage.Model
{

/** Generated Model - DO NOT CHANGE */
using System;
using System.Text;
using VAdvantage.DataBase;
using VAdvantage.Common;
using VAdvantage.Classes;
using VAdvantage.Process;
using VAdvantage.Model;
using VAdvantage.Utility;
using System.Data;
/** Generated Model for VSS_DISCOUNTPOS
 *  @author Jagmohan Bhatt (generated) 
 *  @version Vienna Framework 1.1.1 - $Id$ */
public class X_VSS_DISCOUNTPOS : PO
{
public X_VSS_DISCOUNTPOS (Context ctx, int VSS_DISCOUNTPOS_ID, String trxName) : base (ctx, VSS_DISCOUNTPOS_ID, trxName)
{
/** if (VSS_DISCOUNTPOS_ID == 0)
{
SetDNAME (null);	// P
SetM_Product_ID (0);
SetQUANTITY (0.0);
SetVSS_DISCOUNTPOS_ID (0);
SetVSS_DISCOUNTPRODUCT_ID (0);
}
 */
}
public X_VSS_DISCOUNTPOS (Ctx ctx, int VSS_DISCOUNTPOS_ID, String trxName) : base (ctx, VSS_DISCOUNTPOS_ID, trxName)
{
/** if (VSS_DISCOUNTPOS_ID == 0)
{
SetDNAME (null);	// P
SetM_Product_ID (0);
SetQUANTITY (0.0);
SetVSS_DISCOUNTPOS_ID (0);
SetVSS_DISCOUNTPRODUCT_ID (0);
}
 */
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_VSS_DISCOUNTPOS (Context ctx, DataRow rs, String trxName) : base(ctx, rs, trxName)
{
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_VSS_DISCOUNTPOS (Ctx ctx, DataRow rs, String trxName) : base(ctx, rs, trxName)
{
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_VSS_DISCOUNTPOS (Ctx ctx, IDataReader dr, String trxName) : base(ctx, dr, trxName)
{
}
/** Static Constructor 
 Set Table ID By Table Name
 added by ->Harwinder */
static X_VSS_DISCOUNTPOS()
{
 Table_ID = Get_Table_ID(Table_Name);
 model = new KeyNamePair(Table_ID,Table_Name);
}
/** Serial Version No */
static long serialVersionUID = 27562514384741L;
/** Last Updated Timestamp 7/29/2010 1:07:47 PM */
public static long updatedMS = 1280389067952L;
/** AD_Table_ID=1000021 */
public static int Table_ID;
 // =1000021;

/** TableName=VSS_DISCOUNTPOS */
public static String Table_Name="VSS_DISCOUNTPOS";

protected static KeyNamePair model;
protected Decimal accessLevel = new Decimal(3);
/** AccessLevel
@return 3 - Client - Org 
*/
protected override int Get_AccessLevel()
{
return Convert.ToInt32(accessLevel.ToString());
}
/** Load Meta Data
@param ctx context
@return PO Info
*/
protected override POInfo InitPO (Context ctx)
{
POInfo poi = POInfo.GetPOInfo (ctx, Table_ID);
return poi;
}
/** Load Meta Data
@param ctx context
@return PO Info
*/
protected override POInfo InitPO (Ctx ctx)
{
POInfo poi = POInfo.GetPOInfo (ctx, Table_ID);
return poi;
}
/** Info
@return info
*/
public override String ToString()
{
StringBuilder sb = new StringBuilder ("X_VSS_DISCOUNTPOS[").Append(Get_ID()).Append("]");
return sb.ToString();
}
/** Set Amount.
@param Amount Amount in a defined currency */
public void SetAmount (Decimal? Amount)
{
Set_Value ("Amount", (Decimal?)Amount);
}
/** Get Amount.
@return Amount in a defined currency */
public Decimal GetAmount() 
{
Object bd =Get_Value("Amount");
if (bd == null) return Envs.ZERO;
return  Convert.ToDecimal(bd);
}

/** DNAME AD_Reference_ID=1000022 */
public static int DNAME_AD_Reference_ID=1000022;
/** Amount = A */
public static String DNAME_Amount = "A";
/** Percentage = P */
public static String DNAME_Percentage = "P";
/** Is test a valid value.
@param test testvalue
@returns true if valid **/
public bool IsDNAMEValid (String test)
{
return test.Equals("A") || test.Equals("P");
}
/** Set DNAME.
@param DNAME DNAME */
public void SetDNAME (String DNAME)
{
if (DNAME == null) throw new ArgumentException ("DNAME is mandatory");
if (!IsDNAMEValid(DNAME))
throw new ArgumentException ("DNAME Invalid value - " + DNAME + " - Reference_ID=1000022 - A - P");
if (DNAME.Length > 1)
{
log.Warning("Length > 1 - truncated");
DNAME = DNAME.Substring(0,1);
}
Set_Value ("DNAME", DNAME);
}
/** Get DNAME.
@return DNAME */
public String GetDNAME() 
{
return (String)Get_Value("DNAME");
}
/** Set Description.
@param Description Optional short description of the record */
public void SetDescription (String Description)
{
if (Description != null && Description.Length > 255)
{
log.Warning("Length > 255 - truncated");
Description = Description.Substring(0,255);
}
Set_Value ("Description", Description);
}
/** Get Description.
@return Optional short description of the record */
public String GetDescription() 
{
return (String)Get_Value("Description");
}
/** Set Product.
@param M_Product_ID Product, Service, Item */
public void SetM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1) throw new ArgumentException ("M_Product_ID is mandatory.");
Set_Value ("M_Product_ID", M_Product_ID);
}
/** Get Product.
@return Product, Service, Item */
public int GetM_Product_ID() 
{
Object ii = Get_Value("M_Product_ID");
if (ii == null) return 0;
return Convert.ToInt32(ii);
}
/** Set PERCENATAGE.
@param PERCENATAGE PERCENATAGE */
public void SetPERCENATAGE (int PERCENATAGE)
{
Set_Value ("PERCENATAGE", PERCENATAGE);
}
/** Get PERCENATAGE.
@return PERCENATAGE */
public int GetPERCENATAGE() 
{
Object ii = Get_Value("PERCENATAGE");
if (ii == null) return 0;
return Convert.ToInt32(ii);
}
/** Set Quantity.
@param QUANTITY Quantity */
public void SetQUANTITY (Decimal? QUANTITY)
{
if (QUANTITY == null) throw new ArgumentException ("QUANTITY is mandatory.");
Set_Value ("QUANTITY", (Decimal?)QUANTITY);
}
/** Get Quantity.
@return Quantity */
public Decimal GetQUANTITY() 
{
Object bd =Get_Value("QUANTITY");
if (bd == null) return Envs.ZERO;
return  Convert.ToDecimal(bd);
}
/** Set VSS_DISCOUNTPOS_ID.
@param VSS_DISCOUNTPOS_ID VSS_DISCOUNTPOS_ID */
public void SetVSS_DISCOUNTPOS_ID (int VSS_DISCOUNTPOS_ID)
{
if (VSS_DISCOUNTPOS_ID < 1) throw new ArgumentException ("VSS_DISCOUNTPOS_ID is mandatory.");
Set_ValueNoCheck ("VSS_DISCOUNTPOS_ID", VSS_DISCOUNTPOS_ID);
}
/** Get VSS_DISCOUNTPOS_ID.
@return VSS_DISCOUNTPOS_ID */
public int GetVSS_DISCOUNTPOS_ID() 
{
Object ii = Get_Value("VSS_DISCOUNTPOS_ID");
if (ii == null) return 0;
return Convert.ToInt32(ii);
}
/** Set VSS_DISCOUNTPRODUCT_ID.
@param VSS_DISCOUNTPRODUCT_ID VSS_DISCOUNTPRODUCT_ID */
public void SetVSS_DISCOUNTPRODUCT_ID (int VSS_DISCOUNTPRODUCT_ID)
{
if (VSS_DISCOUNTPRODUCT_ID < 1) throw new ArgumentException ("VSS_DISCOUNTPRODUCT_ID is mandatory.");
Set_Value ("VSS_DISCOUNTPRODUCT_ID", VSS_DISCOUNTPRODUCT_ID);
}
/** Get VSS_DISCOUNTPRODUCT_ID.
@return VSS_DISCOUNTPRODUCT_ID */
public int GetVSS_DISCOUNTPRODUCT_ID() 
{
Object ii = Get_Value("VSS_DISCOUNTPRODUCT_ID");
if (ii == null) return 0;
return Convert.ToInt32(ii);
}
}

}
